package com.bjb.vr.common.utils;


import com.bjb.vr.common.ao.ResBundleAo;
import com.bjb.vr.common.ao.ResPackageDetailAo;

/**
 * @desc: 分页工具<br />
 * @author: Jingbo Hu<br/>
 * @time：2019年11⽉18⽇<br/>
 * @version：v1.0.0<br>
 */
public class PageUtils {

    private static final Long initPageNo = 0L;

    /**
     * 设置分页
     */
    public static void setPageNo(Object obj) {
        if (obj instanceof ResPackageDetailAo) {
            ResPackageDetailAo resPackageDetailAo = (ResPackageDetailAo) obj;
            Long current = resPackageDetailAo.getCurrent();
            Long size = resPackageDetailAo.getSize();
            if (!current.equals(initPageNo)) {
                resPackageDetailAo.setCurrent((current - 1) * size);
            }
        }
        if (obj instanceof ResBundleAo) {
            ResBundleAo resBundleAo = (ResBundleAo) obj;
            Long current = resBundleAo.getCurrent();
            Long size = resBundleAo.getSize();
            if (!current.equals(initPageNo)) {
                resBundleAo.setCurrent((current - 1) * size);
            }
        }
    }

}
